import hilog from '@ohos.hilog'

const DOMAIN = 0xFF00
const PREFIX = 'Ladybug'

export class Logger {
  private tag: string

  constructor(tag: string) {
    this.tag = tag
  }

  debug(msg: string, ...args: any[]) {
    hilog.debug(DOMAIN, `${PREFIX}/${this.tag}`, msg, ...args)
  }

  info(msg: string, ...args: any[]) {
    hilog.info(DOMAIN, `${PREFIX}/${this.tag}`, msg, ...args)
  }

  warn(msg: string, ...args: any[]) {
    hilog.warn(DOMAIN, `${PREFIX}/${this.tag}`, msg, ...args)
  }

  error(msg: string, ...args: any[]) {
    hilog.error(DOMAIN, `${PREFIX}/${this.tag}`, msg, ...args)
  }

  fatal(msg: string, ...args: any[]) {
    hilog.fatal(DOMAIN, `${PREFIX}/${this.tag}`, msg, ...args)
  }
}
